﻿/*
*			高级Media抽象层,可进行拓展兼容各种vedio格式
*
*/


#pragma once

#include "CxType.h"
#include <opencv2/highgui/highgui.hpp>

namespace ImitateTansfer
{

	class CxCapture
	{
	public:
		CxCapture():m_nextcapture(NULL){}
		virtual		~CxCapture(){}
	public:

		virtual		bool		OpenFile(LPCSTR filename)=0;
		virtual		IplImage *	GetFrame()=0;
        virtual     void        SetFrameRate(double)=0;
		virtual		double		GetFrameRate()const=0;
        virtual     bool        isOpened()const=0;
	protected:

		CxCapture	*m_nextcapture;
	};

	class ImpCxCapture :	public CxCapture
	{
	public:
		ImpCxCapture(LPCSTR filename);
		~ImpCxCapture();

	public:

		IplImage 	*GetFrame();
		bool		OpenFile(LPCSTR filename);
		double		GetFrameRate()const;
        void        SetFrameRate(double);

        bool        isOpened()const {return m_isOpened;}
	private:

        bool            m_isOpened;
        size_t          m_currentframe;
        size_t          m_totalframe;
		CvCapture		*m_capture;
		
	};


}
